/*
 *所有关于Luxs_view_project_for_mara类的业务代码应在此处编写
*可使用repository.调用常用方法，获取EF/Dapper等信息
*如果需要事务请使用repository.DbContextBeginTransaction
*也可使用DBServerProvider.手动获取数据库相关信息
*用户信息、权限、角色等使用UserContext.Current操作
*Luxs_view_project_for_maraService对增、删、改查、导入、导出、审核业务代码扩展参照ServiceFunFilter
*/
using VOL.Core.BaseProvider;
using VOL.Core.Extensions.AutofacManager;
using VOL.Entity.DomainModels;
using System.Linq;
using VOL.Core.Utilities;
using System.Linq.Expressions;
using VOL.Core.Extensions;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using MyErp.IRepositories;
using VOL.Core.DBManager;
using MyErp.IServices;

namespace MyErp.Services
{
    public partial class Luxs_view_project_for_maraService
    {
        private readonly IHttpContextAccessor _httpContextAccessor;
        private readonly ILuxs_view_project_for_maraRepository _repository;//访问数据库
       // private readonly ILuxs_project_for_maraRepository _Luxs_project_for_mara;//访问数据库
       // private readonly ILuxs_project_for_maraService _Luxs_project_for_maraService;
        WebResponseContent webResponse = new WebResponseContent();
        [ActivatorUtilitiesConstructor]
        public Luxs_view_project_for_maraService(
            ILuxs_view_project_for_maraRepository dbRepository,
            IHttpContextAccessor httpContextAccessor
           // ILuxs_project_for_maraRepository dbRepository1,
            //ILuxs_project_for_maraService Luxs_project_for_maraService
            )
        : base(dbRepository)
        {
            _httpContextAccessor = httpContextAccessor;
            _repository = dbRepository;
            //_Luxs_project_for_mara = dbRepository1;
            //_Luxs_project_for_maraService = Luxs_project_for_maraService;
            //多租户会用到这init代码，其他情况可以不用
            //base.Init(dbRepository);
        }
        public override WebResponseContent Add(SaveModel saveDataModel)
        {
            //var
            /*using (var db = DBServerProvider.DbContext)
            {
                Luxs_project_for_mara add_m = new Luxs_project_for_mara();
                add_m.mara_id = (System.Guid)("3bf75982-efe9-402b-a36f-87500592437a".ToGuid());// saveDataModel.MainData.mara_id;
                add_m.luxs_project_id = (System.Guid)("82756554-646e-482f-a4c4-6a044f64018f".ToGuid());
                db.Add(add_m);
                db.SaveChanges();//注意不能放在foreach循环里面                      
            }*/       
            //return webResponse.OK();
            return Luxs_project_for_maraService.Instance.Add(saveDataModel);//Luxs_project_for_maraService可以直接使用
            // return base.Add(saveDataModel);
        }
        public override WebResponseContent Del(object[] keys, bool delList = true)
        {
            return Luxs_project_for_maraService.Instance.Del(keys, delList);
            //return base.Del(keys, delList);
        }
    }
}
